package cn.kcq.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.annotation.Generated;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * SaleOrder entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "sale_order", catalog = "order")

public class SaleOrder implements java.io.Serializable {

	// Fields
	private Integer odrId;
	private Integer odrCustomerId;
	private String odrCustomerName;
	private String odrDeliverAddr;
	private Date odrOrderDate;
	private Date odrDeliverDate;
	private String odrStatus;
	private Set<SaleOrderLine> saleOrderLines = new HashSet<SaleOrderLine>(0);

	// Constructors

	/** default constructor */
	public SaleOrder() {
	}

	/** minimal constructor */
	public SaleOrder(Integer odrId, Integer odrCustomerId, String odrCustomerName, String odrDeliverAddr,
			Date odrDeliverDate, String odrStatus) {
		this.odrId = odrId;
		this.odrCustomerId = odrCustomerId;
		this.odrCustomerName = odrCustomerName;
		this.odrDeliverAddr = odrDeliverAddr;
		this.odrDeliverDate = odrDeliverDate;
		this.odrStatus = odrStatus;
	}

	/** full constructor */
	public SaleOrder(Integer odrId, Integer odrCustomerId, String odrCustomerName, String odrDeliverAddr,
			Date odrOrderDate, Date odrDeliverDate, String odrStatus, Set<SaleOrderLine> saleOrderLines) {
		this.odrId = odrId;
		this.odrCustomerId = odrCustomerId;
		this.odrCustomerName = odrCustomerName;
		this.odrDeliverAddr = odrDeliverAddr;
		this.odrOrderDate = odrOrderDate;
		this.odrDeliverDate = odrDeliverDate;
		this.odrStatus = odrStatus;
		this.saleOrderLines = saleOrderLines;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "ODR_ID", unique = true, nullable = false)

	public Integer getOdrId() {
		return this.odrId;
	}

	public void setOdrId(Integer odrId) {
		this.odrId = odrId;
	}

	@Column(name = "ODR_CUSTOMER_ID", nullable = false)

	public Integer getOdrCustomerId() {
		return this.odrCustomerId;
	}

	public void setOdrCustomerId(Integer odrCustomerId) {
		this.odrCustomerId = odrCustomerId;
	}

	@Column(name = "ODR_CUSTOMER_NAME", nullable = false, length = 100)

	public String getOdrCustomerName() {
		return this.odrCustomerName;
	}

	public void setOdrCustomerName(String odrCustomerName) {
		this.odrCustomerName = odrCustomerName;
	}

	@Column(name = "ODR_DELIVER_ADDR", nullable = false, length = 500)

	public String getOdrDeliverAddr() {
		return this.odrDeliverAddr;
	}

	public void setOdrDeliverAddr(String odrDeliverAddr) {
		this.odrDeliverAddr = odrDeliverAddr;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "ODR_ORDER_DATE", length = 10)
	public Date getOdrOrderDate() {
		return this.odrOrderDate;
	}

	public void setOdrOrderDate(Date odrOrderDate) {
		this.odrOrderDate = odrOrderDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "ODR_DELIVER_DATE", nullable = false, length = 10)
	public Date getOdrDeliverDate() {
		return this.odrDeliverDate;
	}

	public void setOdrDeliverDate(Date odrDeliverDate) {
		this.odrDeliverDate = odrDeliverDate;
	}

	@Column(name = "ODR_STATUS", nullable = false, length = 15)
	public String getOdrStatus() {
		return this.odrStatus;
	}

	public void setOdrStatus(String odrStatus) {
		this.odrStatus = odrStatus;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "saleOrder")
	public Set<SaleOrderLine> getSaleOrderLines() {
		return this.saleOrderLines;
	}

	public void setSaleOrderLines(Set<SaleOrderLine> saleOrderLines) {
		this.saleOrderLines = saleOrderLines;
	}

}